import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import City from './components/city/City'
import Detail from './components/detail/Detail'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },{
      path: '/city',
      name: 'City',
      component: City
    },{
      path: '/detail/:id',/*动态路由*/
      name: 'Detail',
      component: Detail
    }],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }/*对于所有路由导航，简单地让页面滚动到顶部。*/
  }
})
